
import React from 'react'
import { Route, Switch } from 'react-router-dom'

// import Log from 'pages/log'
// import Home from 'pages'
// const Home = React.lazy(() => import('pages'))
// const Log = React.lazy(() => import('pages/log'))
import Loadable from 'react-loadable'
const loading = () => <div className="animated fadeIn pt-3 text-center">Loading...</div>
const Home = Loadable({ loader: () => import('pages/'), loading })
const Log = Loadable({ loader: () => import('pages/log'), loading })
const Log_id = Loadable({ loader: () => import('pages/log/_id.js'), loading })
const Advimg = Loadable({ loader: () => import('pages/advimg/'), loading })
const Advimg_id = Loadable({ loader: () => import('pages/advimg/_id.js'), loading })
const Classify = Loadable({ loader: () => import('pages/classify/'), loading })
const Classify_id = Loadable({ loader: () => import('pages/classify/_id.js'), loading })
const Orde = Loadable({ loader: () => import('pages/orde/'), loading })
const Commodity = Loadable({ loader: () => import('pages/commodity/'), loading })
const Commodity_id = Loadable({ loader: () => import('pages/commodity/_id.js'), loading })
//管理界面路由(spa页面用)
function Inifmain(){
  return (
    <div>
      <Switch>
        <Route exact path="/" component={Home} />
        <Route exact path="/log" component={Log} />
        <Route exact path="/log/:id" component={Log_id} />
        <Route exact path="/advimg" component={Advimg} />
        <Route exact path="/advimg/:id" component={Advimg_id} />
        <Route exact path="/classify" component={Classify} />
        <Route exact path="/classify/:id" component={Classify_id} />
        <Route exact path="/commodity" component={Commodity} />
        <Route exact path="/commodity/:id" component={Commodity_id} />
        <Route exact path="/orde" component={Orde} />
      </Switch>
    </div>
  )
}
export {
  Inifmain
}